package com.lmbx.shzh.controller;

import com.lmbx.shzh.domain.common.ResponseResult;
import com.lmbx.shzh.service.PersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @Auther: wyl
 * @Date: 2021/5/12
 * @Description: 值班人员服务
 */
@Slf4j
@Api(tags = "值班人员模块", value = "值班人员服务模块相关接口")
@RestController
@RequestMapping("api/v1/person")
public class PersonController {

    @Autowired
    private PersonService personService;

    @ApiOperation("获得当日值班人员列表")
    @GetMapping("list")
    public ResponseResult list(@ApiParam(name = "vCode",value = "地区编码",example = "1301") @RequestParam("vCode") String vCode) {
        // 查询当天数据
        LocalDate today = LocalDate.now();
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMdd");
        String date = dtf.format(today);

        return personService.selectDutyList(date, vCode);
    }

}
